Variables

Like many things in D, variable declarations are a lot like C, C++, and Java:
Declare three separate integer variable called myInt, myint, and MYINT.

void main()
{
    int myInt;
    int myint;
    int MYINT;
}

Note that variable identifiers in D are case-sensitive:

In the above example, "myInt", "myint", and "MYINT" are separate identifiers.

In D, all variables have to be declared before they are used.

Some Facts About Identifiers
  1. Identifiers must begin with a letter.
  2. Subsequent characters can be numbers or underscores as well as additional letters.
  3. Identifiers can be as long as you want.

Return to Tutorial Overview